package coroutines

import kotlinx.coroutines.*

fun main() = runBlocking {
    GlobalScope.launch { testYield("协程一") }
    GlobalScope.launch { testYield("协程二") }

    val line = readLine()
    println(line)
}

private suspend fun testYield(name: String) {
    println("$name 开始执行了")
    yield()
    println("$name 停止执行")
}
